var tip = document.getElementsByClassName("tip")[0];
function random(min,max){
	return parseInt(Math.random()*(max - min + 1) + min);
}
var k = 0;
var bol = true; 
if($("body").width() >= 600){
	$(".choujiang").width("60%");
	$(".choujiang").height($("#zhuanpan").height());
}
var array1 = [0,40,130,170,290,310,350];
var array7 = [80,100,120,210,250,270];
var array13 = [20,60,150,190,230,330,];
var array19 = [110,140,180,220,340,360];
var array25 = [10,50,90,240,260,300,];
var array31 = [30,70,160,200,280,320];
$("#dianji").on("touchstart",function(){
	var aaa = 0.97297297297297297;
	var sui = random(0,5);
	if($("#textName").val() == 1){
		alert("请选择点数！");
		return;
	}else if($("#textName").val() == 2){
		var suiji = random(0,6);
		var result = array1[suiji]*aaa;
	}else if($("#textName").val() == 3){
		var result = array7[sui]*aaa;
	}else if($("#textName").val() == 4){
		var result = array13[sui]*aaa;
	}else if($("#textName").val() == 5){
		var result = array19[sui]*aaa;
	}else if($("#textName").val() == 6){
		var result = array25[sui]*aaa;
	}else if($("#textName").val() == 7){
		var result = array31[sui]*aaa;
	}
	if(bol){
		bol = false;		
		var t =0;
		var b = 0;
		var c = result + 1080;
		var d = 200;
		var timer = setInterval(function(){
			t++;
			if(t >= d){
				bol = true;
				setTimeout(function(){
					zhongjiang();
				},500);
				
				clearInterval(timer);
			}
			tip.style.webkitTransform = "rotate(" + Tween.Cubic.easeOut(t,b,c,d) + "deg)";
		},20);
	}
});
function zhongjiang(){
	$(".zhongjiang").slideDown(500);
}
$(".kuai").eq(0).on("touchstart",function(){
	$(".zhongjiang").slideUp(300);
	setTimeout(function(){
		$(".box").hide();
		$("#homeBackground").show();
		tip.style.webkitTransform = "rotate(0deg)";
		userName.value = "";
		telephone.value = "";
		var img = new Image;
		m = 1;
		img.src = "images/che_" + m + ".jpg";
		img.onload = function(){
			context.beginPath();
			context.drawImage(img,0,0,canvas.width,canvas.height);
		}
	},300);
	
});

function hehe(){
	
	
	
}
